package com.domain;



import java.math.BigDecimal;import java.lang.reflect.Field;
import java.time.LocalDateTime;import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author li
 * @since 2024-12-20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor

@ApiModel(value="PlayersApplication对象", description="")
public class PlayersApplication implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 游戏名称
     */
    @TableField("game_title")
    private String gameTitle;

    /**
     * 游戏昵称
     */
    @TableField("game_nickname")
    private String gameNickname;

    /**
     * 擅长位置
     */
    @TableField("position")
    private String position;

    /**
     * 擅长角色
     */
    @TableField("character_role")
    private String characterRole;

    /**
     * 收费（元/小时）
     */
    @TableField("price_per_hour")
    private BigDecimal pricePerHour;

    /**
     * 联系电话
     */
    @TableField("contact_phone")
    private String contactPhone;

    /**
     * 游戏截图
     */
    @TableField("skill_image")
    private String skillImage;

    /**
     * 描述
     */
    @TableField("description")
    private String description;

    /**
     * 申请创建时间
     */
    @TableField("created_at")
    private LocalDateTime createdAt;

    /**
     * 0待审核1审核通过2拒绝
     */
    @TableField("status")
    private Integer status;

    /**
     * 申请人的用户ID
     */
    @TableField("user_id")
    private Integer userId;

    /**
     * 根据字段名获取字段值
     * @param fieldName 字段名
     * @return 字段值
     * @throws IllegalArgumentException 如果字段不存在或无法访问
     */
    public String getFieldValue(String fieldName) throws IllegalArgumentException {
        try {
            Field field = this.getClass().getDeclaredField(fieldName);
            field.setAccessible(true);
            Object value = field.get(this);
            return value != null ? value.toString() : "";
        } catch (NoSuchFieldException | IllegalAccessException e) {
            throw new IllegalArgumentException("Invalid field name: " + fieldName, e);
        }
    }
}
